package com.laurent.brewerhistory.controller;

import java.util.List;

import android.content.Context;

import com.laurent.brewerhistory.common.Criteria;

public abstract class DefaultController<T> {
	/**
	 * retrieve all beers present in database
	 * 
	 * @param context
	 *            Context to access database
	 * 
	 * @return Beer's list : Never null
	 */
	public List<T> getAll(Context context) {
		return get(context);
	}

	/**
	 * retrieve all beers defined by the {@link Criteria}'s list
	 * 
	 * @param context
	 *            Context to access database
	 * @param crit
	 *            The list of criteria in order to filter beers
	 * 
	 * @return Beer's list : Never null
	 */
	public abstract List<T> get(Context context, Criteria... crit);

	/**
	 * Save the given object into the database or will update it if it's already
	 * present in database
	 * 
	 * @param context
	 *            Context to access database
	 * @param object
	 *            The object to save
	 */
	public abstract void save(Context context, T object);
}
